package GreatBattleOfAircraft.obj;

import GreatBattleOfAircraft.Main;
import GreatBattleOfAircraft.utils.GameUtils;

import java.awt.*;

public class BulletObj extends GameObj {
    @Override
    public Image getImg() {
        return super.getImg();
    }

    public BulletObj(Image img, int x, int y, int width, int height, double speed, Main frame) {
        super(img, x, y, width, height, speed, frame);
    }

    @Override
    public void painSelf(Graphics graphics) {
        super.painSelf(graphics);
        y +=speed;
        if (this.getRec().intersects(this.frame.planeObj.getRec())){
            Main.state = 3;
        }

        if (y>900){
            this.x = -800;
            GameUtils.removeObjList.add(this);
        }
    }

    @Override
    public Rectangle getRec() {
        return super.getRec();
    }
}
